import AdSelect from '@/components/AdSelect';

export const codes = {
  select: 'DRIVERSELECT',
  enable: 'DRIVERSELECT_ENABLE',
  disable: 'DRIVERSELECT_DISABLED',
  showDetail: 'DRIVERSELECT_VIEW',
  add: 'DRIVERSELECT_ADD',
  edit: 'DRIVERSELECT_UPD',
  editPaper: 'DRIVERSELECT_PAPERS_UPD',
  addPaper: 'DRIVERSELECT_PAPERS_ADD',
  page: 'DRIVERPAGE',
};

export function renderTableAdSelect({ key, data, value, props }) {
  let params = { onlyRead: true, value };
  if (key) {
    const { dictObject } = props;
    params = { data: dictObject[key], payload: { code: [key] }, ...params };
  } else {
    params = { data, ...params };
  }
  return <AdSelect {...params} />;
}
